/*********************************************/
/*                                           */
/*     Common headers and alias              */
/*                                           */
/*********************************************/

#if !defined(_ALIAS_H_)
#define _ALIAS_H_

/** Include C++ standard library headers */
#include <cstdlib>
#include <string>
#include <vector>
#include <map>

/** Include boost share pointer header */
#include <boost/shared_ptr.hpp>

/** Include SType enumerator */
#include "SType.h"

/** Define alias for C++ standard and boost namespaces */
using namespace std;
using namespace boost;

/** Macro to use for import/export symbols from windows libraries */
#define DECLARATION_DLL

#if defined(WIN32)

   /** Set BUILDING_DLL in compiler options when build a windows library */
   #if defined(BUILDING_DLL)

     /** Macro to use for export symbols from windows libraries */
	 #define DECLARATION_DLL __declspec ( dllexport )

   #else

     /** Macro to use for import symbols from windows libraries */
     #define DECLARATION_DLL __declspec ( dllimport )

   #endif

#endif

/** Set the directory path where SCOTT find plugins at run-time */
#if defined(WIN32)
 #define PLUGIN_DIR "./plugins/"
#else
 #define PLUGIN_DIR "./lib/plugins/"
#endif

/**
 * Macro to use before the declaration of a class with name T in the T.h header file.
 * This macro create the following aliases: TSp, TSpVector and TSpVectorSp.
 * TSp is a smart pointer of T ( shared_ptr<T> ).
 * TSpVector is a vector of smart pointers of T ( vector<shared_ptr<T>> ).
 * TSpVectorSp is a smart pointer to a vector of smart pointers of T ( shared_ptr<vector<shared_ptr<T>>> ).
 * Adding the suffix Sp is a toolkit convention for the naming of a smart pointer.
 */ 

#define CREATE_ALIAS( T )                                \
	class DECLARATION_DLL T ;                            \
	typedef shared_ptr< T > T##Sp ;	                     \
	typedef vector< T##Sp > T##SpVector ;                \
	typedef shared_ptr< T##SpVector > T##SpVectorSp ;    \

/**
 * Macro to use before the declaration of a class with name T in the T.h header file.
 * This macro create the following aliases: TSpMap, TSpMapPair and TSpMapSp.
 * TSpMap is a map with string and smart pointers of T ( map<string, TSp> ).
 * TSpMapPair is a pair of string and smart pointers of T ( pair<string, TSp> ).
 * TSpMapSp is a smart pointer to a map with string and smart pointers of T ( shared_ptr<map<string, TSp>> ).
 * Adding the suffix Sp is a toolkit convention for the naming of a smart pointer.
 */ 

#define CREATE_MAP_ALIAS( T )                          \
	typedef map<string, T##Sp > T##SpMap;              \
	typedef pair<string, T##Sp >  T##SpMap##Pair;      \
	typedef shared_ptr< T##SpMap > T##SpMapSp ;       

/** Alias for a smart pointer of string. */
typedef shared_ptr<string> StringSp;

/** Alias for a vector of strings. */
typedef vector<string> StringVector;

/** Alias for a smart pointer to a vector of strings. */
typedef shared_ptr<StringVector> StringVectorSp;

#endif  // _ALIAS_H_
